function outp = LonPredDynamic(state, ctrl)
%% dimensionless state: rad V fpa s;
global m S R0 g0 Vs
rad  = state(1);
V = state(2);
fpa = state(3);
alt = (rad-1)*R0;
[rho, sonic] = getAtmosphere(alt);

alpha = ctrl(1);
absBank = ctrl(2);
Ma = (V*Vs)/sonic;
[CL, CD] = getCLCD(alpha, Ma);
q = 0.5*rho*(V*Vs)^2;
D = q*S*CD/m/g0;
L = q*S*CL/m/g0;

raddot   = V*sin(fpa);
speeddot = -D - sin(fpa)/(rad^2);
fpadot   = L*cos(absBank)/V + cos(fpa)*(V/rad - 1/V/rad/rad);
sdot     = -V*cos(fpa)/rad;
outp  = [raddot, speeddot, fpadot, sdot];
end